﻿using System.Collections.Generic;
using System.IO;

namespace LabyCLI.Commands
{
    class cmd_open
    {
        Terminal frm = Terminal.Instance;

        public void Main(List<string> args)
        {
            foreach (string arg in args)
            {
                if (File.Exists(arg) || Directory.Exists(arg))
                {
                    System.Diagnostics.Process.Start(arg);
                    Terminal.WriteLine("Successfully started the process.");
                    Terminal.WriteLine(string.Empty);
                }
                else
                {
                    Terminal.WriteLine("Invaild file or directory.");
                    Terminal.WriteLine(string.Empty);
                }
            }
        }

        public void Main()
        {
            System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath);
        }
    }
}
